library(tidyverse)

# generate twitter count 
data_tweet <- read_csv(paste0(in_data_dir, "data_tweet.csv.tar.gz"),
                       col_types = c(id_str = "c", 
                                     user_id_str = "c"))
data_tweet %>%
  group_by(lang) %>% 
  summarise(`Forced Labor` = sum(fl), 
            `GSOMIA` = sum(gs), 
            `Export Restriction` = sum(wl),
            `Total` = n()) %>%
  pivot_longer(cols = 2:5, names_to = "Issue") %>%
  pivot_wider(names_from = lang, values_from = value) %>%
  rename(Japanese = 2, Korean = 3) %>%
  write_csv(paste0(out_data_dir, "twitter_count.csv"))


